#! /usr/bin/env python

def run(N, k):
    i = 1 + N * k
    n = (N + 1) * k

    chunked_buff = []
    chunked_size = 65536

    f = open('./data/%03d.sql' % (N, ), 'w+')

    f.write('/*!40101 SET NAMES utf8 */;\n\n')
    while i <= n:
        chunked_buff.append('(%d, 0)' % i)
        if not (i % chunked_size):
            print("%4d lines written." % (i / chunked_size))
            f.write("INSERT INTO `hash_distributed` VALUES %s;\n" % (', '.join(chunked_buff), ))
            chunked_buff = []

        i += 1


if __name__ == '__main__':
    N = 32
    k = (2 ** 32) / N
    for i in range(29, 30):
        run(i, k)

